﻿using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.Revit.DB;
using HYCodeBase.Math;

namespace HYRevitCode.RevitTopologySuite
{
	public abstract class RevitOperationDataBean
	{
		public List<Curve> LstRevitCurve
		{
			get
			{
				return this.m_lstRevitCurve;
			}
			protected set
			{
				this.m_lstRevitCurve = value;
			}
		}

		public double NowZ
		{
			get
			{
				return this.m_dNowZ;
			}
			protected set
			{
				this.m_dNowZ = value;
			}
		}

		internal static bool CheckIfCurvesZSame(List<Curve> input, out double findZ)
		{
			findZ = 0.0;
			if (input == null || input.Count == 0)
			{
				return false;
			}
			List<XYZ> list = new List<XYZ>();
			foreach (Curve curve in input)
			{
				if (!curve.IsBound)
				{
					return false;
				}
				list.Add(curve.GetEndPoint(0));
				list.Add(curve.GetEndPoint(1));
			}
			if (list.Count == 0 || 1 == list.Count)
			{
				return false;
			}
			list = (from k in list
			orderby k.Z
			select k).ToList<XYZ>();
			findZ = list[0].Z;
			return MathUtility.IsEqual(list[0].Z, list[list.Count - 1].Z, 0.0001);
		}

		private List<Curve> m_lstRevitCurve = new List<Curve>();

		private double m_dNowZ;
	}
}
